package com.mr.model;

import java.sql.Timestamp;

import org.apache.commons.lang.StringUtils;
import org.hibernate.validator.constraints.NotEmpty;

import com.mr.util.DateUtil;
public class Video extends BaseObject{
	private static final long serialVersionUID = -4221188457367564057L;
	private Long id;
	private Long relatedid;
	@NotEmpty(message="名称不能为空！")
	private String vlogo;
	private String name;
	private String path;
	private String status;
	private Timestamp addtime;
	private Timestamp updatetime;
	public Timestamp getUpdatetime() {
		return updatetime;
	}
	public void setUpdatetime(Timestamp updatetime) {
		this.updatetime = updatetime;
	}
	public Video(){
		this.addtime = DateUtil.getCurTimestamp();
		this.status = Status.Y;
		this.updatetime= addtime;
	}
	public Video(Long relatedid, String name){
		this();
		this.relatedid = relatedid;
		this.name = name;
	}
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}

	public Long getRelatedid() {
		return relatedid;
	}

	public void setRelatedid(Long relatedid) {
		this.relatedid = relatedid;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public Timestamp getAddtime() {
		return addtime;
	}

	public void setAddtime(Timestamp addtime) {
		this.addtime = addtime;
	}

	public boolean equals(Object o) {
		if (this == o)
			return true;
		if (!(o instanceof Video))
			return false;

		final Video temp = (Video) o;

		return !(this.getId() != null ? !(this.getId().equals(temp.getId()))
				: (temp.getId() != null));

	}

	public int hashCode() {
		return (this.getId() != null ? this.getId().hashCode() : 0);
	}
	public String getPath() {
		return path;
	}
	public void setPath(String path) {
		this.path = path;
	}
	public String getVlogo() {
		return vlogo;
	}
	public void setVlogo(String vlogo) {
		this.vlogo = vlogo;
	}
	public String getSlogo(){
		if(StringUtils.isBlank(vlogo)) return "images/default_video.gif";
		return this.vlogo;
	}
}
